//第二章
package pro;
public class Demo{
    public static void main(String[] args) {
       /*
       //自然数1~99的遍历及1+3+5+7+...+99的和
        int sum = 0;
        for (int i = 1; i <= 99; i++) {
            System.out.println(i);
            //if(i%2!=0)
            if (i % 2 == 1) {
                sum += i;
            }
        }
        System.out.println("1+3+5+7+...+99的值为：" + sum);


        */
        //冒泡排序
        int[] a = {25, 24, 12, 76, 101, 96, 28};
        for (int i = 0; i < a.length - 1; i++) {
            for (int j = 0; j < a.length - i - 1; j++) {
                if (a[j] > a[j + 1]) {
                    int temp = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = temp;
                }
            }
        }
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i] + ",");
        }
    }
}